package Reeks5.VanRansbeeck.Kevin.Model;

import Reeks5.VanRansbeeck.Kevin.Model.States.Game.*;
import java.util.ArrayList;

public class PineappleSpel extends Spel {
    public PineappleSpel() {
        super(true);
    }
    
    @Override
    void setTafel() {
        tafel = new ArrayList<Kaart>(5);
    }

    @Override
    public void addSpeler(Speler s) {
        if(s instanceof PineappleSpeler) {
            this.spelers.add(s);
        }
    }

    public void drawTurn() { // checks & states
        if(this.getSpelContext().getSpelState() instanceof FlopState) {
            this.drawKaart();
            this.getSpelContext().turn();
            setChanged();
            notifyObservers("Turn");
        }
    }
    public void drawRiver() { // checks & states
        if(this.getSpelContext().getSpelState() instanceof RiverState) {
            this.drawKaart();
            this.getSpelContext().turn();
            setChanged();
            notifyObservers("River");
        }
    }
    
    public void blinds() {
        boolean ok = true;
        for(Speler s : this.getSpelers()) {
            if(s.getHolekaarten().size() != 2) {
                ok = false;
            }
        }
        if(ok == true) {
            this.getSpelContext().blinds();
        }
    }

    public void drawFlop() {
        if(this.getSpelContext().getSpelState() instanceof BlindState) {
            this.drawKaart();
            this.drawKaart();
            this.drawKaart();
            this.getSpelContext().flop();
            setChanged();
            notifyObservers("Flop");
        }
    }
    
}
